package com.example.blogother.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xpd.blog.bean.Chat;
import com.xpd.blog.bean.Userinfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xpd
 * @since 2024-09-27
 */
public interface ChatMapper extends BaseMapper<Chat> {
    @Results(id="rm1",value = {
            @Result(column = "id",property = "id",id=true),
            @Result(column = "usid",property = "usid"),
            @Result(column = "usid",property = "userinfo",one = @One(
                    select = "selectByUsid"
            ))
    })
    @Select("select * from chat where status=#{status}")
   List<Chat> selectByUsidOrderByUid(int status);
@Select("select * from userinfo where usid=#{usid}")
    Userinfo selectByUsid(int usid);
}
